From 76c3e5afc26db73906c0546288f0f4de52d5a216 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 15 Sep 2005 09:12:03 +0000 Subject: [PATCH] Like IA32 PAE xenlinux, we also need make VMX guest 1:1 page table PGD page below 4G. Signed-off-by: Xin Li Signed-off-by: Chengyuan Li Signed-off-by: Yunhong Jiang Signed-off-by: Jun Nakajima --- tools/libxc/xc_vmx_build.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index 2efdf289a3..b48fd00417 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -376,9 +376,21 @@ static int setup_guest(int xc_handle, if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL ) goto error_out; -#ifdef __i386__ - /* First allocate page for page dir. */ + /* First allocate page for page dir or pdpt */ ppt_alloc = (vpt_start - dsi.v_start) >> PAGE_SHIFT; + if ( page_array[ppt_alloc] > 0xfffff ) + { + unsigned long nmfn; + nmfn = xc_make_page_below_4G( xc_handle, dom, page_array[ppt_alloc] ); + if ( nmfn == 0 ) + { + fprintf(stderr, "Couldn't get a page below 4GB :-(\n"); + goto error_out; + } + page_array[ppt_alloc] = nmfn; + } + +#ifdef __i386__ l2tab = page_array[ppt_alloc++] << PAGE_SHIFT; ctxt->ctrlreg[3] = l2tab; @@ -414,8 +426,6 @@ static int setup_guest(int xc_handle, munmap(vl1tab, PAGE_SIZE); munmap(vl2tab, PAGE_SIZE); #else - /* First allocate pdpt */ - ppt_alloc = (vpt_start - dsi.v_start) >> PAGE_SHIFT; /* here l3tab means pdpt, only 4 entry is used */ l3tab = page_array[ppt_alloc++] << PAGE_SHIFT; ctxt->ctrlreg[3] = l3tab; -- 2.30.2